package com.lm.framework.adapater;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.lm.utils.Tools;
import com.opensymphony.xwork2.ActionSupport;

public abstract class LmBaseAction extends ActionSupport {
	
	protected HttpServletRequest request;
	protected HttpServletResponse response;
	
	protected LmBaseService service;
	public void setService(LmBaseService service) {
		this.service = service;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		String returnValue=null;
		request = ServletActionContext.getRequest();
		response = ServletActionContext.getResponse();
		if(Tools.isNotNull(returnValue)){
			return returnValue;
		}else{
			returnValue=handler();
			return returnValue;
		}
	}
	
	public abstract void validate();
	
	public abstract String handler()
		throws Exception;
	
}